#	
#	Skeleton for a C parser	
#	Highly incomplete
#
#

import shlex
import re

Identifier = re.compile("[a-zA-Z][a-zA-Z0-9_]*")

def parseFunctionDefinition():
	parseDeclSpecifiers()
	parseDeclList()
	parseCompoundStatement()


def parseDeclSpecifiers():
	parseStorageClassSpec()
	parseDeclSpecifiers()

	or 

	parseTypeSpecifier()
	parseDeclSpecifiers()

	or 

	parseTypeQualifier()
	parseDeclSpecifiers()
	
def parseTypeQualifier():
	pass
def parseStorageClassSpec():
	"auto"
	"register"
	"static"
	"extern"
	"typedef"
	

def parseTypeSpecifier():
	"void"
	"char"
	"int"
	"float"
	"short"
	"double"
	"signed"
	"unsigned"
	"struct-or-union"
	"enum-spec"
	"typedef-name"

def parseTypeQualifier():
	"const"
	"volatile"

def parseStructOrUnionSpecifier():
	parseStructOrUnion()
		parseIdentifier()!
			parseStructDeclList()
def parseStructDeclList():
	parseStructDeclaration()
	parseStructDeclList()

def parseStructDeclaration():
	parseSpecQualifierList()
	parseStructDeclList()

def parseSpecQualifierList():
	parseTypeSpecifier()
	parseSpecQualifierList()[opt]

	or 
	
	parseTypeQualifier()
	parseSpecQualifierList()[opt]

def parseStructDeclaratorList():
	parseStructDeclarator()

	or

	parseStructDeclaratorList() 
	parseStructDeclarator()

def parseStructDeclarator():
	parseDeclarator()	
	
	or

	parseDeclarator()[opt] 
	parseConstExpression()

def parseIdentifier(lexer):

	
	
